//
//  MyBookViewController.swift
//  Mediaplayer
//
//  Created by bin hu on 2025/7/10.
//

import UIKit

class MyBookViewController: BaseViewController {
    
    private lazy var collectionView:UICollectionView = {
        let layout = UICollectionViewFlowLayout()
        layout.itemSize = CGSize(width: (SCREEN_WIDTH - 50)/3, height: 200)
        layout.minimumInteritemSpacing = 10
        layout.minimumInteritemSpacing = 10
        layout.sectionInset = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10)
        let list = UICollectionView(frame: .zero, collectionViewLayout: layout)
        list.delegate = self
        list.dataSource = self
        list.showsVerticalScrollIndicator = false
        list.register(CoverInfoCell.self, forCellWithReuseIdentifier: "CoverInfoCell")
        view.addSubview(list)
        return list
    }()

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        
        collectionView.snp.makeConstraints { make in
            make.edges.equalToSuperview()
        }
        
        collectionView.showSkeletonWithDataSource()
        DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
            self.collectionView.hideTabSkeleton()
        }
    }

}

extension MyBookViewController:UICollectionViewDelegateFlowLayout {
    
}

extension MyBookViewController:UICollectionViewDelegate {
    
}

extension MyBookViewController:UICollectionViewDataSource {
    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        return 4
    }
    
    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "CoverInfoCell", for: indexPath) as! CoverInfoCell
        return cell
    }
}
